#!/bin/sh
lsb_dist=$([ -f /etc/os-release ] && echo "$(grep  "^ID=" /etc/os-release | tr -d "ID=" | tr -d '"')" || echo "" )
sub_lsb_dist=$([ -f /etc/os-release ] && echo "$(grep '^PRETTY_NAME=' /etc/os-release | grep  -o '[0-9.]*' | head -1 | awk -F '.' '{ print $1$2 }' )" || echo "" )


# ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# echo 'Asia/Shanghai' | tee /etc/timezone


# lsb_dist=ubuntu
# ustc.edu.cn  aliyun.com  tuna.tsinghua.edu.cn
if [ "$lsb_dist" = "debian" ]; then
  echo debian
  cp /etc/apt/sources.list /etc/apt/sources.list.bak
  sed -i 's@http://\(deb\|security\).debian.org@http://mirrors.ustc.edu.cn@g' /etc/apt/sources.list
  apt-get update && apt-get install -y bash curl wget
elif [ "$lsb_dist" = "ubuntu" ]; then
  echo ubuntu
  cp /etc/apt/sources.list /etc/apt/sources.list.bak
  sed -i 's@\(archive\|security\).ubuntu.com@mirrors.ustc.edu.cn@g' /etc/apt/sources.list
  apt-get update && apt-get install -y bash curl wget
elif [ "$lsb_dist" = "kali" ]; then
  echo kali
  cp /etc/apt/sources.list /etc/apt/sources.list.bak
  echo 'deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib' | tee /etc/apt/sources.list
  apt-get update && apt-get install -y bash curl wget
else
  echo unknown
fi

# curl https://gitee.com/lgf1244/scripts/raw/main/shell/setup.sh | sh
# wget https://gitee.com/lgf1244/scripts/raw/main/shell/system-init.sh && DOCKER=no POWERSHELL=no DOTNET=no bash ./system-init.sh